<template>
    <fieldset>
        <legend>List组件</legend>
        <ul>
            <li v-for="(item,index) in arr" :key="index">
                {{item}}
            </li>
        </ul>
    </fieldset>
</template>
<script>
export default {
    data () {
        return {
            arr:["睡觉","睡懒觉","睡大懒觉","睡大大懒觉"]
        }
    },
    mounted () {
        this.$bus.$on("add-todo",input=>{
            this.arr.push(input)
            this.$bus.$emit("clear")
        })
    }
}

</script>